home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / setpgms.zip / SETNOW.DOC < prev    next >
Text File  |  1986-12-22  |  2KB  |  68 lines

  1. SETTIME   -  Use to set strings in the environment for DATE and TIME
  2.  
  3. Requires DOS 2.0 or above and 512 bytes of disk and memory space (not resident 
  4. when not in use)
  5.  
  6.  
  7.                  Copyright 1986, Arnold B. Krueger GPW MI 48236
  8.                       (ARNY KRUEGER @EXEC-PC 414-964-5160)
  9.                   Permission for free use and distribution by
  10.                   interested parties, not for profit, granted.
  11.  
  12. SETTIME sets the environment string 'DATE' with the current date: HH:MM:SS.
  13. It also sets the environment string 'TIME' with the current time: MM/DD/YY.
  14.  
  15.  
  16. Use SETTIME to access the current date and time from the DOS Batch language,
  17. as illustrated by the following example: (This file is included in SETNOW.ARC 
  18. as SETTEST.BAT)
  19.  
  20.    echo off
  21.    rem BAT file for logging program use - test file for SETNOW
  22.    setnow
  23.    echo start at: %time% %date%
  24.    set otime=%time%
  25.    set odate=%date%
  26.      .
  27.      .     (code to be logged/timed)
  28.      .
  29.    setnow
  30.    echo end at: %time% %date%
  31.    echo %odate% %otime% start %date% %time% finish >$temp
  32.    copy test.log+$temp test.log >nul
  33.    set otime=
  34.    set odate=
  35.    
  36.  
  37.  
  38.  
  39. This example shows how the power of the DOS Batch language is enhanced
  40. by utility programs that update the environment:
  41.  
  42.       The first 2 lines are overhead and self-documentation. 
  43.       The next 4 lines save and announciate the current date and time. 
  44.       The lines shown as an elipse (...) are the process to be timed or logged. 
  45.       The next 4 lines obtain the date and time at the end of the test, 
  46.           and update a log file named test.log.
  47.       The last 2 lines clean up the enironment.
  48.  
  49.       Resolution of SETTIME is one second. There is a variable delay in
  50.       running it, depending on the speed of your CPU and disk. Figure on
  51.       no better than 2 second accuracy.
  52.  
  53. ERRORLEVEL setting by this program:
  54.  
  55. Errorlevel=1 Means the DOS release is not at least 2. An error message is 
  56.              typed. No changes to the environment result.
  57.  
  58. Errorlevel=2 Means that the time or date string was too long to fit in the 
  59.              environment.  An error message is typed. 
  60.  
  61.              This problem can be avoided by extending the size of the 
  62.              environment using CONFIG.SYS options, AND running SETNOW in 
  63.              AUTOEXEC.BAT.  
  64.  
  65. 
  66.  
  67.  
  68.